package com.yitiao.config;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;

@Configuration
public class GatewayConfig {

    /** 读取配置的超时时间 */
    public static final long DEFAULT_TIMEOUT = 30000;

    /** Nacos 服务器地址 */
    public static String NACOS_SERVER_ADDR;

    /** 命名空间 */
    public static String NACOS_NAMESPACE;

    /** data-id */
    public static String NACOS_ROUTE_DATA_ID;

    /** 分组 id */
    public static String NACOS_ROUTE_GROUP;

    @Value("${spring.cloud.nacos.discovery.server-addr}")
    public void setNACOS_SERVER_ADDR(String NACOS_SERVER_ADDR) {
        this.NACOS_SERVER_ADDR = NACOS_SERVER_ADDR;
    }

    @Value("${spring.cloud.nacos.discovery.namespace}")
    public void setNACOS_NAMESPACE(String NACOS_NAMESPACE) {
        this.NACOS_NAMESPACE = NACOS_NAMESPACE;
    }

    @Value("${spring.cloud.nacos.custom.gateway.router.data-id}")
    public void setNACOS_ROUTE_DATA_ID(String NACOS_ROUTE_DATA_ID) {
        this.NACOS_ROUTE_DATA_ID = NACOS_ROUTE_DATA_ID;
    }

    @Value("${spring.cloud.nacos.custom.gateway.router.group}")
    public void setNACOS_ROUTE_GROUP(String NACOS_ROUTE_GROUP) {
        this.NACOS_ROUTE_GROUP = NACOS_ROUTE_GROUP;
    }
}
